// Name:            Topbar
// Description:     Define style for topbar
//
// Component:       `.am-topbar`
//
// Sub-objects:     `.am-topbar-nav`
//                  `.am-topbar-nav-subtitle`
//                  `.am-topbar-collapse
//                  `.am-topbar-brand`
//                  `.am-topbar-toggle`
//                  `.am-topbar-left`
//                  `.am-topbar-right`
//                  `.am-topbar-form`
//                  `.am-topbar-btn`
//
// Modifiers:       `.am-topbar-inverse`
//
// States:          `.am-active`
//                  `.am-disabled`
//
// Use:              Dropdown
//                   Collapse
//
// ========================================================================

/* ========================================================================
   Component: Topbar
 ========================================================================== */

.am-topbar {
  position: relative;
  //padding: 0 10px;
  min-height: @topbar-height;
  margin-bottom: @topbar-margin-bottom;
  background: @topbar-default-bg;
  border-bottom: 1px solid @topbar-default-border;

  .clearfix();

  color: @topbar-default-color;

  a {
    color: @topbar-default-link-color;
  }
}

// brand
.am-topbar-brand {
  margin: 0;
  @media @medium-up {
    float: left;
  }

  a {
    &:hover {
      color: @topbar-default-brand-hover-color;
    }
  }
}

.am-topbar-collapse {
  width: 100%;
  overflow-x: visible;
  padding: @topbar-padding-horizontal;
  .clearfix();
  clear: both;
  -webkit-overflow-scrolling: touch;
  // max-height: @topbar-collapse-max-height;

  &.am-in {
    overflow-y: auto;
  }

  @media @medium-up {
    margin-top: 0;
    padding: 0;
    width: auto;
    clear: none;

    &.am-collapse {
      display: block !important;
      height: auto !important;
      padding: 0;
      overflow: visible !important;
    }

    &.am-in {
      overflow-y: visible;
    }
  }
}

// Brand in topbar

.am-topbar-brand {
  padding: 0 @topbar-padding-horizontal;
  float: left;
  font-size: @font-size-lg;
  height: @topbar-height;
  line-height: @topbar-height;
}


// Topbar toggle in samll device

.am-topbar-toggle {
  position: relative;
  float: right;
  margin-right: @topbar-padding-horizontal;

  @media @medium-up {
    display: none;
  }
}


// .am-nav within topbar

.am-topbar-nav {
  @media @small-only {
    margin-bottom: @topbar-spacing-vertical;
    > li {
      float: none;
    }
  }

  > li {
    & + li {
      @media @small-only {
        margin-left: 0;
        margin-top: 5px;
      }
    }
  }

  @media @medium-up {
    float: left;

    > li {
      > a {
        position: relative;
        line-height: 50px;
        padding: 0 @topbar-padding-horizontal;

        &:after {
          position: absolute;
          left: 50%;
          margin-left: -6px;
          bottom: 0;
          content: "";
          .caret-up(6px, @topbar-default-bg);
        }

        &:hover:after {
          border-bottom-color: @topbar-default-color;
        }
      }

      // hide dropdown caret
      &.am-dropdown {
        > a:after {
          display: none;
        }
      }

      // nav active status
      &.am-active {
        > a {
          &,
          &:hover,
          &:focus {
            border-radius: 0;
            color: @topbar-default-link-active-color;
            background: none;
          }

          &:after {
            border-bottom-color: @topbar-default-link-active-color;
          }
        }
      }
    }
  }
}


// dropdown in topbar

.am-topbar-collapse {
 .am-dropdown.am-active {
   @media @small-only {
     .am-dropdown-content {
       float: none;
       position: static;
       width: 100%;
       &:before {
         display: none;
       }
     }

     .am-icon-caret-down {
     }
   }
 }
}

// Component alignment

@media @medium-up {
  .am-topbar-left {
    .am-fl();
  }

  .am-topbar-right {
    .am-fr();
    margin-right: @topbar-padding-horizontal;
  }
}


// form in topbar

.am-topbar-form {
  .am-form-group {
    @media @small-only {
      margin-bottom: 5px;
    }
  }

  @media @medium-up {
    padding: 0 @topbar-padding-horizontal;

    margin-top: @topbar-spacing-vertical;

    .am-form-group + .am-btn {
      margin-left: 5px;
    }
  }
}


// Btn in topbar

.am-topbar-btn {
  margin-top: @topbar-spacing-vertical;
}

.am-topbar-collapse {
  .am-topbar-btn,
  .am-btn {
    @media @small-only {
      display: block;
      width: 100%;
    }
  }
}


// Inverse topbar
// ------------------------------------------------------------------------

.am-topbar-inverse {
  background-color: @topbar-inverse-bg;
  border-bottom-color: @topbar-inverse-border;
  color: @topbar-inverse-color;

  a {
    color: @topbar-inverse-link-color;
  }

  .am-topbar-brand {
    a {
      color: @topbar-inverse-brand-color;
      &:hover,
      &:focus {
        color: @topbar-inverse-brand-hover-color;
        background-color: @topbar-inverse-brand-hover-bg;
      }
    }
  }

  .am-topbar-nav {
    > li {
      > a {
        color: @topbar-inverse-link-color;

        // THE RIGHT ORDOR :hover:after
        &:hover,
        &:focus {
          color: @topbar-inverse-link-hover-color;
          background-color: @topbar-inverse-link-hover-bg;

          &:after {
              border-bottom-color: darken(@topbar-inverse-bg, 10%);
          }
        }

        &:after {
          border-bottom-color: @topbar-inverse-bg;
        }
      }

      &.am-active > a {
        &,
        &:hover,
        &:focus {
          color: @topbar-inverse-link-active-color;
          background-color: @topbar-inverse-link-active-bg;

          &:after {
            border-bottom-color: @topbar-inverse-link-active-color;
          }
        }
      }

      .disabled > a {
        &,
        &:hover,
        &:focus {
          color: @topbar-inverse-link-disabled-color;
          background-color: @topbar-inverse-link-disabled-bg;
        }
      }
    }
  }
}
